<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机分队伍</title>
    <script src="axios.min.js"></script>
    <style>
        *{
            margin:0;
            padding:0;
        }
        body{
            background-image: url(images/bg.jpg);
            background-attachment: fixed;
            background-repeat: no-repeat;
            background-size:100% 100%;
        }
        .card{
            height: 400px;
            width: 250px;
            background-color: rgba(0,0,0,.5);
            background-repeat: no-repeat;
            background-size: contain;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
        }
        .num{
            height: 80%;
            width: 100%;
            color: red;
            text-align: center;
            line-height: 320px;
            font-size:240px;
        }
        .btn{
            height:10%;
            width:100%;
            display:flex;
            justify-content:center;
            align-item:center;
            color:white;
            font-size:18px;
        }

    </style>
</head>
<body>
    <script>
        function getNum() {
            axios({
                method: 'get',
                url: 'http://www.kuken.tech/rand/getOne',
            }).then(function (res) {
                console.log(res);
                var btnone = document.getElementById("innerNum")
                btnone.innerHTML = res.data.data.numValue
            })
        }
        function reset(){
            axios({
                method: 'delete',
                url: 'http://www.kuken.tech/rand/delete',
            }).then(function (res) {
                console.log(res);
                document.getElementById("innerNum").innerHTML = "";
                alert(res.data.data)
            })
        }
    </script>
    <div class="card">
        <div class="num" id="innerNum"></div>
        <div class="btn"><button id="one" onclick="getNum()">获取随机码</button></div>
        <div class="btn1"><button id="set" onclick="reset()">重置</button></div>
    </div>
    
</body>
</html>